close all;
clear all;

inputvideo = 'video.avi';

nr = 256;       %input image size - num of rows
nc = 256;       %input image size - num of cols
Nc= 1;          % number of center channels
q = quantizer('fixed', [32,20]);    %input data representation (32 bits, 20 fraction bits)

in_mov = aviread(inputvideo);
num_frames= size(in_mov(:,:),2);
out_mov(1:num_frames) = struct('cdata', [],'colormap', []);

%%aviobj = avifile('SaliencyPSU.avi','compression','None');
scrsz= get(0,'ScreenSize');

h=figure('position',[200 scrsz(4)/3 scrsz(3)/2 scrsz(4)/3]);
r=subplot(1,2,1);
axis equal
%%set(gca,'nextplot', 'replacechildren');
p=subplot(1,2,2);
axis equal
%%set(gca,'nextplot', 'replacechildren');

input_im_prev=zeros(size(in_mov(1,1).cdata));

for i=1:num_frames
input_im_curr = in_mov(1,i).cdata; 
if(i>1)
input_im_prev = in_mov(1,i-1).cdata; 
end
    
 
[Sal, iSal, cSal, oSal,mSal,fSal, im2] = saliency_hw_sim(input_im_prev,input_im_curr, nr, nc, Nc, i);

axes(r)
imagesc(imresize(input_im_curr, [nr,nc]));
title (['Frame Number  ', num2str(i)]);
axes(p)
imagesc(imresize(Sal,[nr,nc]));
title (['FPGA Saliency  ', num2str(i)]);
pause(0.033)
out_mov(i)= getframe(h);
%%aviobj= addframe(aviobj,out_mov);
end

close(h);
%%aviobj=close(aviobj);
%%h=figure('position',[100 scrsz(4)/3 scrsz(3)/2 scrsz(4)/3]);
%movie(h,F,1);
% movie2avi(out_mov, 'gm3_noflick_SaliencyPSU_Nc1.avi', 'compression', 'None');



    
  